package com.mofeng.myshop.domain.vo.base;

import com.mofeng.myshop.domain.po.base.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.Date;

@AllArgsConstructor
@NoArgsConstructor
@Data
public class BaseVo implements Serializable {
    @Schema(description = "id")
    protected String id;

    @Schema(description = "名称")
    protected String name;

    @Schema(description = "备注")
    protected String remarks;

    @Schema(description = "描述")
    protected String description;

    @Schema(description = "排序索引")
    protected Integer orderIndex;

    @Schema(description = "创建时间")
    protected Date createTime;

    @Schema(description = "更新时间")
    protected Date updateTime;

    public BaseVo(BaseEntity baseEntity) {
        this.id = baseEntity.getId() == null ? "" : baseEntity.getId().toString();
        this.name = baseEntity.getName();
        this.remarks = baseEntity.getRemarks();
        this.description = baseEntity.getDescription();
        this.orderIndex = baseEntity.getOrderIndex();
        this.createTime = baseEntity.getCreateTime();
        this.updateTime = baseEntity.getUpdateTime();
    }
}
